#include <reg52.h>
typedef unsigned char uint8;
typedef unsigned int uint16;
typedef unsigned long uint32;
sbit ENLED = P1^4;
sbit ADDR0 = P1^0;
sbit ADDR1 = P1^1;
sbit ADDR2 = P1^2;
sbit ADDR3 = P1^3;

uint8 counter=0;
uint8 num=0;
uint8 a=20;

//定时器初始化
void timer0_init()
{
	TMOD|=0x01;
	TMOD&=0xfd;
	TR0=1;
	TH0=0xfc;
	TL0=0x67;
}
//中断初始化
void int_init()
{
	EA=1;
	ET0=1;
}


void main()
{
	uint32 a;
	uint32 b;
	ENLED=0;ADDR3=1;
	ADDR0=0;ADDR1=1;ADDR2=1;
	P0=0xff;
	//timer0_init();
	//int_init();
	
	while(1)
	{
		P0=0xff;
		for(a=0;a<650;a++)
		{
			uint16 y;
			P0&=0xfe;
			for(y=120;y<(1000-a*10)/6&&a*10<1000;y++)
			{
				P0|=0x01;
			}
		}
		//uint8 j=0;
		for(b=0;b<1000;b++)
		{
			if(b<200){
				P0=0xfd;
			}
			if(b>200&&b<400)
			{
				P0=0xfb;
			}
			if(b>400&&b<600)
			{
				P0=0xf7;
			}
			if(b>600&&b<750)
			{
				P0=0xef;
			}
			if(b>750&&b<900)
			{
				P0=0xdf;
			}
			if(b>900)
			{
				P0=0xbf;
			}
			if(b>950)
			{
				P0=0x7f;
			}
		}

	}
}
